<template>
  <u-dialog v-model="display_"
            :title="$t('mod.title')"
            type="none">
    <q-list>
      <q-item v-for="item in noteChangeModList"
              :key="item"
              tag="label"
              v-ripple>
        <q-item-section side>
          <q-radio v-model="noteChangeMod" :val="item"/>
        </q-item-section>
        <q-item-section>
          <q-item-label>{{ $t(`mod.${item}.name`) }}</q-item-label>
          <q-item-label caption>{{ $t(`mod.${item}.caption`) }}</q-item-label>
        </q-item-section>
      </q-item>
    </q-list>
  </u-dialog>
</template>

<script>
  import UDialog from "src/components/public/UDialog";
  import {noteChangeModList} from "src/lib/modUtil";

  export default {
    name: "Mod",
    components: {UDialog},
    props: {
      display: {
        type: Boolean,
        default: false
      }
    },
    data: function () {
      return {
        display_: this.display,
        noteChangeMod: 'none',
        noteChangeModList
      };
    },
    watch: {
      display(n) {
        this.display_ = n;
      },
      display_(n) {
        this.$emit('onDisplayChange', n)
      },
      noteChangeMod() {
        this.$store.commit('setNoteChangeMod', this.noteChangeMod);
      }
    },
    model: {
      prop: 'display',
      event: 'onDisplayChange'
    },
    mounted(){
      this.noteChangeMod = this.$store.getters.noteChangeMod;
    }
  }
</script>

<style scoped>

</style>
